<template>
  <u-picker :show="show" :columns="columns" :keyName="keyName" @cancel="handleHideModal" @confirm="handleConfirm" :confirmColor="confirmColor"></u-picker>
</template>

<script>
export default {
  name:'l-picker',
  data(){
    return{
      show:false,
    }
  },
  props:{
    // 数据
    columns:{
      type:Array,
      required:true
    },
    // 展示的字段名
    keyName:{
      type:String,
      default:"name"
    },
    // 确认按钮颜色
    confirmColor:{
      type:String,
      default:"#E2C176"
    }
  },
  methods:{
    handleOpenModal(){
      this.show=true
    },
    handleHideModal(){
      this.show=false
      this.$emit('cancel');
    },
    handleConfirm(e){
     this.$emit('confirm',e.value);
     this.handleHideModal()
    }
  }
}
</script>

<style lang="scss" scoped>

</style>